home *** CD-ROM | disk | FTP | other *** search
/ Game Programming in C++ - Start to Finish / GameProgrammingS.iso / developer_install / CEGUISDK-0.4.1-VC6-STLport.exe / {app} / include / CEGUISchemeManager.h < prev    next >
C/C++ Source or Header  |  2005-06-04  |  5KB  |  186 lines

  1. /************************************************************************
  2.     filename:     CEGUISchemeManager.h
  3.     created:    21/2/2004
  4.     author:        Paul D Turner
  5.     
  6.     purpose:    Defines the interface to the SchemeManager class
  7. *************************************************************************/
  8. /*************************************************************************
  9.     Crazy Eddie's GUI System (http://www.cegui.org.uk)
  10.     Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
  11.  
  12.     This library is free software; you can redistribute it and/or
  13.     modify it under the terms of the GNU Lesser General Public
  14.     License as published by the Free Software Foundation; either
  15.     version 2.1 of the License, or (at your option) any later version.
  16.  
  17.     This library is distributed in the hope that it will be useful,
  18.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  19.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  20.     Lesser General Public License for more details.
  21.  
  22.     You should have received a copy of the GNU Lesser General Public
  23.     License along with this library; if not, write to the Free Software
  24.     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  25. *************************************************************************/
  26. #ifndef _CEGUISchemeManager_h_
  27. #define _CEGUISchemeManager_h_
  28.  
  29. #include "CEGUIBase.h"
  30. #include "CEGUIString.h"
  31. #include "CEGUISingleton.h"
  32. #include "CEGUIIteratorBase.h"
  33. #include <map>
  34.  
  35.  
  36. #if defined(_MSC_VER)
  37. #    pragma warning(push)
  38. #    pragma warning(disable : 4275)
  39. #    pragma warning(disable : 4251)
  40. #endif
  41.  
  42.  
  43. // Start of CEGUI namespace section
  44. namespace CEGUI
  45. {
  46. /*!
  47. \brief
  48.     A class that manages the creation of, access to, and destruction of GUI Scheme objects
  49. */
  50. class CEGUIEXPORT SchemeManager : public Singleton<SchemeManager>
  51. {
  52. public:
  53.     /*!
  54.     \brief
  55.         Constructor for SchemeManager objects
  56.     */
  57.     SchemeManager(void);
  58.  
  59.  
  60.     /*!
  61.     \brief
  62.         Destructor for SchemeManager objects
  63.     */
  64.     ~SchemeManager(void);
  65.  
  66.  
  67.     /*!
  68.     \brief
  69.         Return singleton SchemeManager object
  70.  
  71.     \return
  72.         Singleton SchemeManager object
  73.     */
  74.     static    SchemeManager&    getSingleton(void);
  75.  
  76.  
  77.     /*!
  78.     \brief
  79.         Return pointer to singleton SchemeManager object
  80.  
  81.     \return
  82.         Pointer to singleton SchemeManager object
  83.     */
  84.     static    SchemeManager*    getSingletonPtr(void);
  85.  
  86.  
  87.     /*!
  88.     \brief
  89.         Loads a scheme
  90.  
  91.     \param scheme_filename
  92.         String object that holds the filename of the scheme to be loaded
  93.  
  94.     \param resourceGroup
  95.         Resource group identifier to be passed to the resource manager.  NB: This
  96.         affects loading of the scheme xml file only, scheme resources may specify
  97.         their own groups.
  98.  
  99.     \return
  100.         Pointer to an object representing the loaded Scheme.
  101.     */
  102.     Scheme*    loadScheme(const String& scheme_filename, const String& resourceGroup = "");
  103.  
  104.  
  105.     /*!
  106.     \brief
  107.         Unloads all data referenced in a scheme.  If any object is using some resource which is listed in the scheme, this function
  108.         will effectively pull the rug out from under those objects.  This should be used with extreme caution, or not at all.
  109.  
  110.     \param scheme_name
  111.         String object specifying the name of the Scheme to be unloaded.
  112.     */
  113.     void    unloadScheme(const String& scheme_name);
  114.  
  115.  
  116.     /*!
  117.     \brief
  118.         Returns true if the named Scheme is present in the system (though the resources for the scheme may or may not be loaded)
  119.  
  120.     \param scheme_name
  121.         String object specifying the name of the Scheme to check for.
  122.  
  123.     \return
  124.         true if the scheme is loaded, false if it is not.
  125.     */
  126.     bool    isSchemePresent(const String& scheme_name) const        {return (d_schemes.find(scheme_name) != d_schemes.end());}
  127.  
  128.  
  129.     /*!
  130.     \brief
  131.         Returns a pointer to the Scheme object with the specified name.
  132.  
  133.     \param name
  134.         String object holding the name of the Scheme to be returned.
  135.  
  136.     \return
  137.         Pointer to the Scheme named \a name.
  138.  
  139.     \exception UnknownObjectException    thrown if no Scheme named \a name is present in the system
  140.     */
  141.     Scheme*    getScheme(const String& name) const;
  142.  
  143.  
  144.     /*!
  145.     \brief
  146.         Unload all schemes currently defined within the system.
  147.  
  148.     \note
  149.         Calling this method has the potential to be very dangerous; if any of the
  150.         data that forms part of the scheme is still in use, you can expect
  151.         fireworks shortly after!
  152.  
  153.     \return
  154.         Nothing.
  155.     */
  156.     void    unloadAllSchemes(void);
  157.  
  158. private:
  159.     /*************************************************************************
  160.         Implementation Data
  161.     *************************************************************************/
  162.     typedef    std::map<String, Scheme*> SchemeRegistry;
  163.     SchemeRegistry    d_schemes;            //!< Collection that tracks the loaded Schemes.
  164.  
  165.  
  166. public:
  167.     /*************************************************************************
  168.         Iterator stuff
  169.     *************************************************************************/
  170.     typedef    ConstBaseIterator<SchemeRegistry>    SchemeIterator;
  171.  
  172.     /*!
  173.     \brief
  174.         Return a SchemeManager::SchemeIterator object to iterate over the available schemes.
  175.     */
  176.     SchemeIterator    getIterator(void) const;
  177. };
  178.  
  179. } // End of  CEGUI namespace section
  180.  
  181. #if defined(_MSC_VER)
  182. #    pragma warning(pop)
  183. #endif
  184.  
  185. #endif    // end of guard _CEGUISchemeManager_h_
  186.